﻿using WCFIServices;
using System.ComponentModel;
using System.ServiceModel;

namespace WCFClientService
{
	[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
	public class PushMessageService : MessageBoxIService, INotifyPropertyChanged
	{
		private string message;
	    private Employee _employee;

	    public PushMessageService()
		{
		}

		public void MessageBox(MessageData messageData)
		{
			Message = messageData.Message;
		}

	    public void MessageBoxWithEmployee(Employee employee)
	    {
            Employee = employee;
	    }

	    public string Message
		{
			get { return message; }
			set
			{
				if (message != value)
				{
					message = value;
					OnPropertyChanged("PushMessageService.Message.Changed");
				}
			}
		}

	    public Employee Employee
	    {
	        get { return _employee; }
	        set
	        {
                if (_employee != value)
                {
                    _employee = value;
                    OnPropertyChanged("PushMessageService.Message.Changed");
                }
	        }
	    }

	    #region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;

		public void OnPropertyChanged(string propertyName)
		{
			PropertyChangedEventHandler handler = this.PropertyChanged;
			if (handler != null)
				handler(this, new PropertyChangedEventArgs(propertyName));
		}

		#endregion
	}
}
